{include file="public/_header" /}

<div class="x-body">

    <div class="layui-tab-content">
        <div class="layui-tab-item layui-show">
            <div class="layui-row">
                <form class="layui-form layui-col-md12 x-so" action="{:url('message/index')}" method="post">
                    <input class="layui-input" placeholder="开始日" name="start_time" id="start" value="{$start_time}">
                    <input class="layui-input" placeholder="截止日" name="end_time" id="end" value="{$end_time}">
                    <input type="text" name="keyword" placeholder="请输入关键字搜索" autocomplete="off" class="layui-input">

                    <div class="layui-input-inline">
                        <select  id="type" name="type" class="type">
                            <option value="">请选择</option>
                            <option value="1" {if condition="$type == 1"
                                    }selected {/if}>新留言</option>
                            <option value="2" {if condition="$type == 2"
                                    }selected {/if}> 意向客户</option>
                            <option value="3" {if condition="$type == 3"
                                    }selected {/if}> 已处理</option>
                        </select>
                    </div>

                    <div class="layui-input-inline">
                        <select lay-filter="provinceId" id="province" name="province" class="provinceid">
                            <option value="">省份</option>
                            {volist name='province' id='pro'}
                            <option value="{$pro.provinceid}" {if $province_select==$pro.provinceid } selected {/if}>{$pro.province}</option>
                            {/volist}
                        </select>
                    </div>

                    <div class="layui-input-inline">
                        <select id="city_id" name="city" class="childId">
                            <option value="">城市</option>
                            {volist name='city' id='vo'}
                            <option value="{$vo.cityid}" {if $city_select==$vo.cityid } selected {/if}>{$vo.city}</option>
                            {/volist}
                        </select>
                    </div>



                    <div class="layui-input-inline">
                        <select  id="message_form" name="message_form" class="message_form">
                            <option value="">请选择</option>
                            <option value="1" {if condition="$message_form == 1"
                                    }selected {/if}>个性定制留言</option>
                            <option value="2" {if condition="$message_form == 2"
                                    }selected {/if}> 设计服务留言</option>
                        </select>
                    </div>



                    <button class="layui-btn" lay-submit="" lay-filter="sreach2"><i class="layui-icon">搜索</i></button>
                    <a class="layui-btn layui-btn-small" class="layui-btn layui-btn layui-btn-mini " style="float: right"
                       href="javascript:location.replace(location.href);" title="刷新">
                        <i class="layui-icon" style="line-height:30px">ဂ</i>
                    </a>
                </form>
            </div>
            <table class="layui-table">
                <thead>
                <tr>
                    <th>ID</th>
                    <th>省份</th>
                    <th>城市</th>
                    <th>姓名</th>
                    <th>电话</th>
                    <th>行业</th>
                    <th>类型</th>
                    <th>提交日期</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody class="tr-data">
                {volist name="message_list" id="vo"}
                <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.province_name}</td>
                    <td>{$vo.city_name}</td>
                    <td>{$vo.name}</td>
                    <td>{$vo.tel}</td>
                    <td>{$vo.trade_name}</td>
                    <td>{$vo.type_name}</td>
                    <td>{$vo.create_time|date="Y/m/d",###}</td>
                    <td class="td-manage">
                        <a title="查看"
                           onclick="message_show('查看','{:url('message/info',['id'=>$vo.id])}',900,500)"
                           href="javascript:;">
                            <i class="layui-icon">查看</i>
                        </a>
                    </td>
                </tr>
                {/volist}
                </tbody>
            </table>
        </div>
        <div class="page">
            {$message_list->render()}
        </div>
    </div>
    {include file="public/_footer" /}
    <script>
        layui.use('laydate', function () {
            var laydate = layui.laydate;

            //执行一个laydate实例
            laydate.render({
                elem: '#start' //指定元素
            });

            //执行一个laydate实例
            laydate.render({
                elem: '#end' //指定元素
            });
        });

        /*用户-停用*/
        function member_stop(obj, id) {
            layer.confirm('确认要停用吗？', function (index) {

                if ($(obj).attr('title') == '启用') {

                    //发异步把用户状态进行更改
                    $(obj).attr('title', '停用')
                    $(obj).find('i').html('&#xe62f;');

                    $(obj).parents("tr").find(".td-status").find('span').addClass('layui-btn-disabled').html('已停用');
                    layer.msg('已停用!', {icon: 5, time: 1000});

                } else {
                    $(obj).attr('title', '启用')
                    $(obj).find('i').html('&#xe601;');

                    $(obj).parents("tr").find(".td-status").find('span').removeClass('layui-btn-disabled').html('已启用');
                    layer.msg('已启用!', {icon: 5, time: 1000});
                }

            });
        }

        layui.use(['form', 'layer'], function () {
            $ = layui.jquery;
            var form = layui.form
                    , layer = layui.layer;
            var util = layui.util;


        });

        //城际联动
        var SCOPE = {
            "city_url": "{:url('admin/Advertuser/getCity')}",
        };


        /**
         * @param title 标题
         * @param url 请求的url
         * @param w 弹出层宽度（缺省调默认值）
         * @param h 弹出层高度（缺省调默认值）
         */
        function message_show(title,url,w,h){
            if (title == null || title == '') {
                title=false;
            };
            if (url == null || url == '') {
                url="404.html";
            };
            if (w == null || w == '') {
                w=($(window).width()*0.9);
            };
            if (h == null || h == '') {
                h=($(window).height() - 50);
            };
            layer.open({
                type: 2,
                area: [w+'px', h +'px'],
                fix: false, //不固定
                maxmin: true,
                shadeClose: true,
                shade:0.4,
                title: title,
                content: url
            });
        }
    </script>
    <script>var _hmt = _hmt || [];
    (function () {
        var hm = document.createElement("script");
        hm.src = "https://hm.baidu.com/hm.js?b393d153aeb26b46e9431fabaf0f6190";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();</script>
    </body>

    </html>